<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('服务对话列列表')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>

                                <input type="text" class="form-control" name="beginTime" id="beginTime"
                                       placeholder="呼叫开始时间" />
                            </li>
                            <li>

                                <input type="text" class="form-control" name="endTime" id="endTime"
                                       placeholder="呼叫结束时间" />
                            </li>
                            <li>

                                <input type="text" name="fromnum"   placeholder="呼入手机号" />
                            </li>


                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>


            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
     <th:block th:include="include :: footer"/>
     <th:block th:include="include :: datetimepicker-js"/>
     <script type="text/javascript">
         layui.use('laydate', function () {

             function getMonthStart() {
                 var now = new Date(); // 获取当前日期时间
                 var monthStart = new Date(now.getFullYear(), now.getMonth(), 1); // 获取本月第一天的日期时间
                 var monthEnd = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59); // 获取本月最后一天的日期时间（时间为23:59:59）
                 return monthStart;
             }

             function getMonthEnd() {
                 var now = new Date(); // 获取当前日期时间
                 var monthStart = new Date(now.getFullYear(), now.getMonth(), 1); // 获取本月最后一天的日期时间
                 var monthEnd = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59); // 获取本月最后一天的日期时间（时间为23:59:59）
                 return monthEnd;
             }

             layui.laydate.render({
                 elem: '#beginTime',
                 theme: 'molv',
                 trigger: 'click',
                 value: getMonthStart(),
                 type: 'datetime'
             })

             layui.laydate.render({
                 elem: '#endTime',
                 theme: 'molv',
                 value: getMonthEnd(),
                 trigger: 'click',
                 type: 'datetime'
             })
         });
     </script>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:service:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:service:remove')}]];
        var prefix = ctx + "system/service";

        $(function() {
            var options = {
                url: prefix + "/listwjt/5",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "服务对话列",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'serviceId',
                    title: '通话Id',
                    visible: true
                },
                {
                    field: 'beginTime',
                    title: '呼叫发起时间'
                },
                {
                    field: 'endTime',
                    title: '呼叫挂断时间'
                },
                {
                    field: 'customerid',
                    title: '客户姓名',
                    formatter: function (value, row, index) {
                        if (row.customerid == '-'){
                            return '未知客户'
                        }else{
                            return  '未知客户'
                        }
                    }
                },
                {
                    field: 'fromnum',
                    title: '呼入号码'
                },
                {
                    field: 'cmpid',
                    title: '呼出号码'
                },
                {
                    field: 'satisfaction',
                    title: '状态',
                    formatter: function (value, row, index) {
                        if (row.state == '5'){
                            return '未接通'
                        }else{
                            return  '接通'
                        }
                    }

                },
                    {
                        title: '操作',
                        align: 'center',
                        formatter: function (value, row, index) {
                            var actions = [];
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.serviceId + '\')"><i class="fa fa-edit"></i>查看</a> ');

                            return actions.join('');
                        }


                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>